﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace mysix
{
   
    public partial class Form2 : Form
    {
        string myvalue = "";
        public Form2(string value)
        {
            InitializeComponent();
            myvalue = value;
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            string s1 = textBox1.Text;
            string s2 = textBox2.Text;
            SchoolDB myschool = new SchoolDB();

            if (myvalue == "Add")
            {
                myschool.AddSchool(int.Parse(s1), s2);
                dbmanager mydb = new dbmanager();
                mydb.AddLog("School", "Add", "新增了SchoolId为" + s1 + "的学校");
               
            }
            if (myvalue == "Update")
            {
                myschool.UpdateSchool(int.Parse(s1), s2);
                dbmanager mydb = new dbmanager();
                mydb.AddLog("School", "Update", "更新了SchoolId为" + s1 + "的学校");
            }
            this.Close();
        }
    }
}
